{use class="common\library\Def"}
{include file="user.header.html"}
{$build_upload}
{$build_editor}
<div id="main" class="clearfix"> {include file="user.menu.html"}
  <div id="right"> {include file="user.curlocal.html"}
    <div class="wrapful"> {include file="user.submenu.html"}
      <div class="wrap">
        <div class="public">
          <div class="information">
            <form method="post" enctype="multipart/form-data" id="my_store_form">
              <div class="setup">
                <div class="clearfix">
                  <div class="photo relative1">
                    <p><img src="{$store.store_logo|default:$app->params['default_store_logo']|url_format}" width="120" height="120" ectype="store_logo" /></p>
                    <div class="filePicker filePicker_store_logo"
                      style=" position:absolute; left:0; top:131px; height:30px; width:120px;"></div>
                    <input type="hidden" name="store_logo" value="{$store.store_logo}" />
                    <b>
                      <div class="txt" style="position:absolute;z-index:9">{$lang.change_store_logo}</div>
                    </b>
                  </div>

                  <div class="photo relative2">
                    <p><img src="{$store.store_banner|default:'data/system/banner.gif'|url_format}" width="730" height="120" ectype="store_banner" /></p>
                    <div class="filePicker filePicker_store_banner"
                      style=" position:absolute; left:20px; top:131px; height:30px; width:120px;"></div>
                    <input type="hidden" name="store_banner" value="{$store.store_banner}" />
                    <b>
                      <span class="txt">{$lang.change_store_banner}</span> </b>
                    <b class="ml10" style="background-color: #f60;"><a
                        href="{url route='store/index' id=$store.store_id}" target="_blank" class="txt">查看店铺</a></b>
                    <div class="clear"></div>
                  </div>
                </div>
                <div class="info shop">
                  <table class="mt20 w-full">
                    <tr>
                      <th class="width2">{$lang.store_name}:</th>
                      <td>
                        <p class="td_block">
                          <input id="store_name" type="text" class="text width_normal" name="store_name"
                            value="{$store.store_name|escape}" />
                          <label class="field_notice">{$lang.store_name}</label>
                        </p>
                    </tr>
                    <tr>
                      <th>{$lang.region}:</th>
                      <td>
                        <div id="region">
                          <input type="hidden" name="region_id" value="{$store.region_id}" class="mls_id" />
                          <input type="hidden" name="region_name" value="{$store.region_name|escape}"
                            class="mls_names" />
                          <!-- {if $store.store_id} -->
                          <span>{$store.region_name|escape}</span>
                          <input type="button" value="{$lang.edit}" class="edit_region" />
                          <select style="display:none">
                            <option>{$lang.select_pls}</option>{html_options options=$regions}
                          </select>
                          <!-- {else} -->
                          <select class="select">
                            <option>{$lang.select_pls}</option>{html_options options=$regions}
                          </select>
                          <!-- {/if} -->
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <th>{$lang.address}:</th>
                      <td>
                        <p class="td_block">
                          <input type="text" name="address" class="text width_normal" id="address"
                            value="{$store.address|escape}" />
                          <span class="field_notice">{$lang.address_info}</span>
                        </p>
                      </td>
                    </tr>
                    <tr>
                      <th>{$lang.tel}:</th>
                      <td><input name="tel" type="text" class="text width_normal" id="tel"
                          value="{$store.tel|escape}" /></td>
                    </tr>
                    <tr>
                      <th>{$lang.im_qq}:</th>
                      <td><input name="im_qq" type="text" class="text width_normal" id="im_qq"
                          value="{$store.im_qq|escape}" /></td>
                    </tr>
                    <tr>
                      <th class="align3">{$lang.description}:</th>
                      <td>
                        <div class="editor">
                          <div>
                            <textarea name="description" id="description"
                              style="width:765px; height:400px;">{$store.description|escape}</textarea>
                          </div>
                          <div class="multimage-wrapper descimage-wrapper">
                            <ul class="multimage-tabs clearfix">
                              <li class="selected">插入描述图片</li>
                            </ul>
                            <div class="multimage-panels clearfix">
                              <div class="upload_btn">
                                <div class="btn-upload-image"><b class="hide EDITOR_SWFU_filePicker"></b></div>
                              </div>
                              <div class="text">{$lang.note_for_upload}</div>
                            </div>
                            <div class="multimage-piclist clearfix">
                              <ul id="desc_images" class="preview J_descriptioneditor">
                                <!--{foreach from=$store.desc_images item=image}-->
                                <li ectype="handle_pic" file_type="{$image.file_type}"
                                  file_name="{$image.file_name|escape}" file_path="{$image.file_path|url_format}"
                                  file_id="{$image.file_id}">
                                  <input type="hidden" name="desc_file_id[]" value="{$image.file_id}">
                                  <div class="pic"> <img src="{$image.file_path|url_format}" width="80" height="80"
                                      alt="{$image.file_name|escape}" title="{$image.file_name|escape}" /> </div>
                                  <div ectype="handler" class="bg">
                                    <p class="operation"> <a class="cut_in" ectype="insert_editor"
                                        href="javascript:void(0);" ecm_title="{$lang.insert_editor}"></a> <span
                                        class="delete" ectype="drop_image" ecm_title="{$lang.drop}"></span> </p>
                                  </div>
                                </li>
                                <!--{/foreach}-->
                              </ul>
                            </div>
                            <div class="notice-word {if !$store.desc_images}hidden{/if}" style="padding:14px;">
                              <p class="yellow">插入方法：将鼠标移至需要插入的图片上面，然后点击插入按钮，即可将图片插入到编辑器中。</p>
                            </div>
                          </div>
                          <div class="clear"></div>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <th></th>
                      <td>
                        <div class="issuance">
                          <input type="submit" class="btn-alipay" style="width:200px;" value="{$lang.submit}" />
                        </div>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
  $(function () {

    $('.filePicker_store_logo').compressUpload({
      server: "{url route='upload/index'}",
      pick: '.filePicker_store_logo',
      fileVal: 'store_logo',
      formData: {
        "{$app->request->csrfParam}": "{$app->request->csrfToken}",
        belong: "{Def::BELONG_STORE}",
        filename: "store_logo"
      },
      crop: true,
      callback: function (file, response, pick, target) {
        $(pick).parent().find('img').attr('src', url_format(response.retval) + "?" + Math.random());
        $('input[name="store_logo"]').val(response.retval);
      }
    });
    $('.filePicker_store_banner').compressUpload({
      server: "{url route='upload/index'}",
      pick: '.filePicker_store_banner',
      fileVal: 'store_banner',
      formData: {
        "{$app->request->csrfParam}": "{$app->request->csrfToken}",
        belong: "{Def::BELONG_STORE}",
        filename: "store_banner"
      },
      crop: true,
      compress: false,
      callback: function (file, response, pick, target) {
        $(pick).parent().find('img').attr('src', url_format(response.retval) + "?" + Math.random());
        $('input[name="store_banner"]').val(response.retval);
      }
    });

    regionInit("region");
  });
  function add_uploadedfile(file_data) {
    $('#desc_images').parent().next('.notice-word').show();
    $('#desc_images').append('<li style="z-index:4" file_type="' + file_data.file_type + '" file_name="' + file_data.file_name + '" file_path="' + url_format(file_data.file_path) + '" ectype="handle_pic" file_id="' + file_data.file_id + '"><input type="hidden" name="desc_file_id[]" value="' + file_data.file_id + '"><div class="pic" style="z-index: 2;"><img src="' + url_format(file_data.file_path) + '" width="80" height="80" alt="' + file_data.file_name + '" /></div><div ectype="handler" class="bg" style="z-index: 3;display:none"><p class="operation"><a href="javascript:void(0);" class="cut_in" ectype="insert_editor" ecm_title="{$lang.insert_editor}"></a><span class="delete" ectype="drop_image" ecm_title="{$lang.drop}"></span></p></div></li>');
    trigger_uploader();
    if (EDITOR_SWFU.getStats().progressNum == 0) {
      window.setTimeout(function () {
        $('#editor_uploader').css('opacity', 0);
        $('*[ectype="handle_pic"]').css('z-index', 999);
      }, 5000);
    }
  }
  function drop_image(file_id) {
    layer.open({
      content: lang.uploadedfile_drop_confirm, btn: [lang.confirm, lang.cancel],
      yes: function (index) {
        $.getJSON("{url route='my_store/deleteimage'}", { id: file_id }, function (data) {
          if (data.done) {
            $('*[file_id="' + file_id + '"]').remove();
          } else {
            layer.msg(data.msg);
          }
          layer.close(index);
        });
      },
      no: function (index) {
        layer.close(index);
      }
    });
  }
</script>
{include file="user.footer.html"}